home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Appearance = 0 'Flat
- BorderStyle = 3 'Fixed Dialog
- Caption = "Wave VBX Action Sample"
- ClientHeight = 2550
- ClientLeft = 1650
- ClientTop = 1920
- ClientWidth = 4095
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 1
- weight = 700
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H80000008&
- Height = 2955
- Left = 1590
- LinkTopic = "Form1"
- ScaleHeight = 2550
- ScaleWidth = 4095
- Top = 1575
- Width = 4215
- Begin VB.TextBox txtFileLength
- Appearance = 0 'Flat
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 285
- Left = 240
- TabIndex = 6
- Top = 1200
- Width = 3615
- End
- Begin VB.TextBox txtFilename
- Appearance = 0 'Flat
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 285
- Left = 240
- TabIndex = 3
- Text = "C:\WINDOWS\RINGOUT.WAV"
- Top = 480
- Width = 3615
- End
- Begin VB.CommandButton btnStop
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Stop"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 2760
- TabIndex = 2
- Top = 1920
- Width = 1095
- End
- Begin VB.CommandButton btnPause
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Resume"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 1500
- TabIndex = 1
- Top = 1920
- Width = 1095
- End
- Begin VB.CommandButton btnPlay
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Play"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 240
- TabIndex = 0
- Top = 1920
- Width = 1095
- End
- Begin WaveLib.Wave Wave1
- Left = 3360
- Top = 0
- _version = 65537
- _extentx = 847
- _extenty = 847
- _stockprops = 64
- exclusive = 0 'False
- filename = ""
- filelength = 0
- loop = 0 'False
- playend = -1
- playstart = -1
- End
- Begin VB.Label Label2
- Appearance = 0 'Flat
- Caption = "File Length:"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H80000008&
- Height = 255
- Left = 240
- TabIndex = 5
- Top = 960
- Width = 2415
- End
- Begin VB.Label Label1
- Appearance = 0 'Flat
- Caption = "Filename:"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H80000008&
- Height = 255
- Left = 240
- TabIndex = 4
- Top = 240
- Width = 1935
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Dim fChanged As Integer ' flag: has filename changed?
- Private Sub btnPause_Click()
- ' if the user wants to pause
- If btnPause.Caption = "Pause" Then
- ' pause
- Wave1.Action = 2
- Else
- ' resume
- Wave1.Action = 3
- End If
- EnableButtons
- End Sub
- Private Sub btnPlay_Click()
- ' make sure the filename is up to date
- SetFilename
- ' play the file
- Wave1.Action = 1
- EnableButtons
- End Sub
- Private Sub btnStop_Click()
- ' stop playing
- Wave1.Action = 4
- ' update buttons
- EnableButtons
- End Sub
- Private Sub EnableButtons()
- Select Case Wave1.Status
- Case 1: ' playing
- If btnPause.Caption <> "Pause" Then
- btnPause.Caption = "Pause"
- End If
- btnStop.Enabled = True
- btnPause.Enabled = True
- Case 2: ' paused
- If btnPause.Caption <> "Resume" Then
- btnPause.Caption = "Resume"
- End If
- btnStop.Enabled = True
- btnPause.Enabled = True
- Case 4: ' stopped
- If btnPause.Caption <> "Pause" Then
- btnPause.Caption = "Pause"
- End If
- btnStop.Enabled = False
- btnPause.Enabled = False
- End Select
- End Sub
- Private Sub Form_Load()
- fChanged = True
- EnableButtons
- End Sub
- Private Sub SetFilename()
- ' if the filename has changed, tell Wave VBX
- If fChanged Then
- ' changed no more
- fChanged = False
- Wave1.filename = txtFilename
- ' set the file length field
- txtFileLength = Format(Wave1.FileLength / 1000, "0.000") & " seconds"
- End If
- End Sub
- Private Sub txtFilename_Change()
- fChanged = True
- End Sub
- Private Sub Wave1_PlayDone()
- EnableButtons
- End Sub
-